// import { acquireVsCodeApi } from "./mockdata";

const vscode = acquireVsCodeApi();


export function loadEvents(pageIndex : Number, pageSize : Number = 500, keywords : string = "") {
	console.log('loadEvents:', pageIndex, pageSize, keywords)
	vscode.postMessage({
		cmd: 'load-events',
		pageIndex,
		pageSize,
		keywords
	});
}


export function openLink(link : string, docPath: string = '') {
	console.log('openLink:', link)
	vscode.postMessage({
		cmd: 'open-link',
		link,
		docPath
	});
}

export function focusEvent(time : Number, groupId : string, title : string, content : string) {
	console.log('focusEvent:', time, groupId, title)
	vscode.postMessage({
		cmd: 'focus-event',
		time,
		groupId,
		title,
		content
	});
}

export function goTo(keywords: string = null) {
	console.log('goTo:', keywords)
	
	vscode.postMessage({
		cmd: 'goTo',
		keywords
	});
}

export function showMsg(text: string, level: 'info'| 'warn'| 'error' = 'info') {
	console.log('showMsg:', text, level)
	
	vscode.postMessage({
		cmd: 'show-msg',
		text,
		level
	});
}

export function showHelp() {
	console.log('showHelp')
	
	vscode.postMessage({
		cmd: 'show-help'
	})
}

export function uiReady(){
	console.log('uiReady')
	
	
	vscode.postMessage({
		cmd: 'ui-ready'
	})
}